#include "../include/QTools.h"
#include "QGLView.h"
QTools::QTools(QGLView* _view,QDessinGL* _visu): QFrame(){

    view=_view;
    visu=_visu;

	ui.setupUi(this);

    this->move(600,30);

	connect(ui.pinceau,SIGNAL(valueChanged(int)),visu,SLOT(setTaillePinceau(int)));
	connect(ui.lambda,SIGNAL(valueChanged(double)),visu,SLOT(setLambda(double)));
    connect(ui.dt,SIGNAL(valueChanged(double)),visu,SLOT(setDeltat(double)));
    connect(ui.nbIter,SIGNAL(valueChanged(int)),visu,SLOT(setNbIter(int)));
	connect(ui.Previsu,SIGNAL(clicked(bool)),visu,SLOT(setPrevisu(bool)));
	connect(ui.Launch,SIGNAL(released()),visu,SLOT(Lauch()));
	connect(ui.dt2_2,SIGNAL(valueChanged(double)),visu,SLOT(setDeltat2(double)));
	connect(ui.dt3,SIGNAL(valueChanged(double)),visu,SLOT(setDeltat3(double)));
	connect(ui.lambda3,SIGNAL(valueChanged(double)),visu,SLOT(setLambda2(double)));
	connect(ui.toolBox,SIGNAL(currentChanged(int)),visu,SLOT(setAlgo(int)));
	connect(ui.sigma,SIGNAL(valueChanged(double)),visu,SLOT(setSigma(double)));
	connect(ui.buttonGroup,SIGNAL(buttonClicked(int)),visu,SLOT(setRandMask(int)));
	connect(ui.deltat4,SIGNAL(valueChanged(double)),visu,SLOT(setDeltat4(double)));
	connect(ui.Nvecteurs,SIGNAL(clicked(bool)),visu,SLOT(setNvecteurs(bool)));
}

void QTools::closeEvent(QCloseEvent *event){
    view->close();
    event->accept();
}

